package com.haoze.nurse.dao;

import com.haoze.common.mapper.MyMapper;
import com.haoze.nurse.model.EmrFileIndexEntity;
import com.haoze.nurse.model.EmrTemplateDetailEntity;
import com.haoze.nurse.model.FileIndexDataEntity;
import com.haoze.nurse.vo.FileIndexDataDetailVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface FileIndexMapper extends MyMapper<EmrFileIndexEntity> {
    Map<String, String> getPatientInfo(@Param("inpatNum") String inpatNum);

    Map<String, String> getUser(@Param("userId") String userId);

    String getLatestTransferBedNo(@Param("inpatNum") String inpatNum);

    int getFileCnt(@Param("inpatNum") String inpatNum,@Param("ctlId") String ctlId);

    String getLatestFileIndexBedNo(@Param("inpatNum") String inpatNum);

    List<Map<String, String>> getDatasetListNew(@Param("tplId") String tplId);

    List<Map<String, String>> queryAllObservations(@Param("inpatNum") String inpatNum,@Param("tplId") String tplId);

    List<Map<String, Object>> createEmrFileData(@Param("emrFileIndex") EmrFileIndexEntity emrFileIndex);

    List<Map<String, String>> getAllSelections(@Param("id") String id);

    List<FileIndexDataEntity> queryRefData(@Param("quoteId") String quoteId,@Param("emrType") String emrType,@Param("inpatNum") String inpatNum,@Param("quoteAll") String quoteAll);

    List<Map<String, Object>> getAllFileIndexDataEntity(@Param("emrFileId") String emrFileId,@Param("parentFileIndexDataId") String parentFileIndexDataId,@Param("showINOUT") String showINOUT);

    String getGroupNameByUserId(@Param("userId") String userId);

    String getArchiveFlag(@Param("inpatNum") String inpatNum);

    Integer getPositionLevel(@Param("userId") String userId);

    Integer queryLevel(@Param("userId") String userId);

    void recordBeforeUpdate(@Param("emrFileId") String emrFileId);

    /**
     * 新旧数据比较
     *
     * @param emrFileId
     * @param fileIndexDataMarkId
     * @param doctorId
     */
    void compareAfterUpdate(@Param("emrFileId") String emrFileId,
                            @Param("fileIndexDataMarkId") String fileIndexDataMarkId,
                            @Param("doctorId") String doctorId);

    List<Map<String, Object>> getInvalidDeletedElements(@Param("emrFileId") String emrFileId);

    String getLatestMainDiag(@Param("inpatNum") String inpatNum);

    void updateMainDiag(@Param("inpatNum") String inpatNum, @Param("mainDiagId") String mainDiagId);

    String getGyneUrl();

    List<String> getSignElementIds();

    Map<String, String> getSysUser(@Param("correctUsername") String correctUsername);

    FileIndexDataEntity getCorrectDiagId(@Param("inpatNum") String inpatNum);

    Integer queryExistCorrectSignLevel(@Param("emrFileId") String emrFileId);

    Integer queryTopSignLevel(@Param("inpatNum") String inpatNum, @Param("emrFileId") String emrFileId);

    void updateSign(@Param("emrFileId") String emrFileId, @Param("correctUser") Map<String, String> correctUser);

    void stopCritical(@Param("itemIds") String[] itemIds);

    String getEmrType(@Param("emrFileId") String emrFileId);

    String getPrintType(@Param("emrFileId") String emrFileId);

    String getSysElementId(@Param("varCode") String varCode);

    /**
     * 查询变更详情
     *
     * @param emrFileId
     * @return
     */
    List<FileIndexDataDetailVO> queryDetail(@Param("emrFileId") String emrFileId);

    String getPath(@Param("parentFileIndexDataId") String parentFileIndexDataId, @Param("emrFileId") String emrFileId);

    /**
     * 根据type查询枚举类中的varCode获取sys_var表中的varValue作为elementid返回
     * @param varCode
     * @return
     */
    String querySysElementId(@Param("varCode") String varCode);


    List<EmrTemplateDetailEntity> getHeadTemplateDetail(@Param("param")String param, @Param("tplId")String tplId);

    List<Map<String,String>> querySameTplFileIndex(@Param("inpatNum") String inpatNum,@Param("tplId") String tplId,
                                       @Param("strTm") String strTm,@Param("endTm") String endTm,@Param("isDesc") String isDesc);

    List<Map<String,String>> getNurseFileTree(@Param("inpatNum") String inpatNum,@Param("isReview") String isReview);

    String getHeadTplId(@Param("tplId")String tplId);

    List<String> getRealize(@Param("inpatNum") String inpatNum,@Param("tplId")  String tplId);

    String getEmrFileId(@Param("inpatNum") String inpatNum,@Param("emrType") String emrType);
}
